This application is based upon and claims priority of Japanese Patent Application No. 11-330728, filed Nov. 19, 1999, the contents being incorporated herein by reference.
1. Field of the Invention
The present invention relates to compiler which interprets a source program that is coded in a specific programming language and creates object code, and, more particularly, the present invention relates to a system for performing an optimized process wherein a compiler creates parallel processes for the processes that are coded in the source program.
2. Description of the Related Art
Conventional automatic parallel process creation methods create parallel processes for processes that are coded in a source program. The conventional automatic parallel process creation methods partition repeating ranges in the source program, such as those notated by DO statements, into, for example, four sections, and assign thread processes to each of the partitioned ranges. The individual thread processes are executed in parallel. The conventional types of automatic parallel process creation methods use the same space for each thread, and execute the threads in parallel.
Recently, the OpenMP Application Program Interface (API) has come into use. The OpenMP API (hereinafter referred to as OpenMP) can be used to execute independent processes in parallel because it is able to have each of the respective threads that are executed in parallel possess their own spaces.
When the conventional automatic parallel process creation method is used for parallel process creation on processes that are notated in the source program, the threads for each of the ranges that have been partitioned perform in parallel processes that all access the same space. Thus, the respective threads cannot access the shared space simultaneously so that the execution is like a sequential process in this part of the program, and a problem results in that the speed of execution is not adequately increased.
Furthermore, with respect to resources that have been automatically placed in parallel, compiled and executed in the past, all of these processes must be recompiled after correction of the programs to apply the new OpenMP. However, correcting all existing programs requires an extremely large amount of resources.
Because of the large amount of resources required to correct existing programs, the creation of full parallel processing for programs that have been placed in parallel and compiled in the past can be achieved by using the OpenMP only on those sections where parallel processing has not been possible, which is desirable because it achieves high-speed processing by furthering the parallel structures on only those parts that can be corrected easily.
The present invention solves the above-noted problems of the conventional automatic parallel process creation method by providing the easy creation of parallel processes through a combination of automatic creation of parallel processes and the OpenMP approach to speed up software execution.
Moreover, the present invention prevents reduction in performance during parallel processing by controlling the wasted creation of threads when processes mutually call each other.
The present invention provides a system to optimally perform parallel process creation with respect to a source program which executes a variety of processes. The system includes an optimizing device which performs optimizing, such as parallel processing, with respect to the parts of the source program that can be processed in parallel. The optimizing device comprises an analysis system and a parallel process creation system. The analysis system performs tasks, such as analyzing the source program and extracting the processes that can be placed in parallel. The parallel process creation system creates parallel processes for the processes extracted by the analysis system.
In operation, a first parallel process creation system generates code, which code creates a plurality of threads for the notation in the source program corresponding to repeating processes for which there is no instruction for the creation of parallel processes. A second parallel process creation system creates threads to reference information that is controlled relative to the notations of processes which have instructions for the creation of parallel processes. When the threads are created, the second parallel process creation system creates parallel processes using the OpenMP API.
The analysis system extracts information that calls the second parallel process creation system processes that can be put in parallel from the first parallel process creation system processes that can be put in parallel by analyzing the source program. When the parallel process creation system performs a process that transfers from the first parallel process creation system process that can be processed in parallel to the second parallel process creation system process that can be processed in parallel, a decision is made as to whether or not parallel processes have already been created. If parallel process have already been created, the creation of further parallel processes is prevented, and in those areas where parallel processes have already been created, the processes that create the threads for creating parallel processes are segmented into procedures and the appropriate code is generated. At this time, the notation is as per the second parallel process creation system that is notated using the OpenMP API.
In accordance with embodiments of the present invention, a computer readable recording medium implements with a computer a method of optimally creating parallel processes for a source program, the method comprising generating code to create a plurality of threads relative to repeating processes for which the source program does not include instructions for parallel processing; storing in a memory information regarding the respective threads created; and generating code to create threads that reference information controlled by the thread control management system for the threads, wherein information is stored in the memory relative to the respective threads created for the processes for which parallel processing is specified. The computer readable medium may be a hard drive or a removable storage medium.
In accordance with embodiments of the present invention, it is not only easily possible to speed up the creation of parallel processes by providing the combination of automatic parallel process creation and OpenMP, but it is also possible to prevent deterioration of performance during parallel processing by controlling the generation of wasted threads when parallel threads call each other.